package com.demo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.demo.mapper.EmployeeEntryMapper;
import com.demo.pojo.EmployeeEntry;
import com.demo.service.EmployeeEntryService;
import org.springframework.stereotype.Service;

@Service
public class EmployeeEntryServiceImpl extends ServiceImpl<EmployeeEntryMapper, EmployeeEntry> implements EmployeeEntryService {

    @Override
    public EmployeeEntry getByEmployeeName(String employeeName) {
        // 可通过LambdaQueryWrapper实现条件查询
        return lambdaQuery()
                .eq(EmployeeEntry::getEmployeeName, employeeName)
                .one();
    }

    @Override
    public boolean addEmployeeEntry(EmployeeEntry employeeEntry) {
        // 可选：插入前可设置默认值（如创建时间、状态等）
        // 例如：employeeEntry.setCreateTime(new Date()); // 设置创建时间为当前时间
        // 例如：employeeEntry.setStatus(1); // 设置默认状态为“有效”
        // 调用MyBatis-Plus的save方法执行插入，返回插入是否成功（true/false）
        return this.save(employeeEntry);
    }
}